export const swap = function(){
    var suffix = window.location.host;
    if(suffix.search(/(vip)+$/) === -1){
      return false;
    }
    return true;
}

export const getUrlParms = function(name) {
  var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
  let path = window.location.search.substr(1)
  let hash = window.location.hash
  let index = hash.lastIndexOf('?')
  let str
  if (path) {
    str = path
  } else {
    str = hash.substring(index + 1, hash.length)
  }
  let r = str.match(reg)
  // let reg_chinese = new RegExp('[\\u4E00-\\u9FFF]+', 'g')  // 检测中文
  if (r !== null) {
    return decodeURI(r[2])
    // unescape(r[2]) encodeURI()把中文转义
  }
  return null
}
